import axios from 'axios'
import { getToken } from './auth'
const service = axios.create({
    // baseURL: 'http://172.20.10.6:8888/api'
    baseURL: 'http://127.0.0.1:8888/api'
})
service.interceptors.request.use(config =>
{
    const token = getToken()
    config.headers.Authorization = `Bearer ${token}`
    return config
})
service.interceptors.response.use(res =>
{
    return res.data;
}, err =>
{
    ElMessage({
        showClose: true,
        message: err.response.data.meta.msg,
        type: 'error',
    })
    return Promise.reject(err)
})
export default service